#include <iostream>

using namespace std;
char b[21][21];
void f(char c)
{
    int i,j,p,c1,c2;
    for(i=1;i<=15;i++)
    {
        for(j=1;j<=15;j++)
        {
            for(p=0,c1=c2=0;p<5;p++)
            {
                if(b[i][j+p]=='.')c1++;
                if(b[i][j+p]==c)c2++;
            }
            if(c1==1&&c2==4)
            {
                cout<<"YES"<<endl;
                return ;
            }
              for(p=0,c1=c2=0;p<5;p++)
            {
                if(b[i+p][j]=='.')c1++;
                if(b[i+p][j]==c)c2++;
            }
            if(c1==1&&c2==4)
            {
                cout<<"YES"<<endl;
                return ;
            }
              for(p=0,c1=c2=0;p<5;p++)
            {
                if(b[i+p][j+p]=='.')c1++;
                if(b[i+p][j+p]==c)c2++;
            }
            if(c1==1&&c2==4)
            {
                cout<<"YES"<<endl;
                return ;
            }
            for(p=0,c1=c2=0;p<5;p++)
            {
                if(i-p<1)break;
                if(b[i-p][j+p]=='.')c1++;
                if(b[i-p][j+p]==c)c2++;
            }
            if(c1==1&&c2==4)
            {
                cout<<"YES"<<endl;
                return ;
            }
        }
    }
    cout<<"NO"<<endl;
}
int main()
{
    int T,i,j,nb,nw;
    cin>>T;
    while(T--)
    {
        fill(b[0],b[0]+21*21,0);
        for(i=1,nb=nw=0;i<=15;i++)
        {
            for(j=1;j<=15;j++)
            {
                cin>>b[i][j];
                if(b[i][j]=='W')nw++;
                else if(b[i][j]=='B')nb++;
            }
        }
        if(nb==nw) f('B');
        else f('W');
    }
    return 0;
}
